package com.geekaca.atm;

import java.util.ArrayList;
import java.util.Scanner;

public class ReviewMain {
    public static void main(String[] args) {

        String names = "张无忌,张三丰,刘德华,周芷若";

        ArrayList<Account> namesList = new ArrayList<>();
        String[] namearr = names.split(",");
        for (int i = 0; i < namearr.length; i++) {
            Account account = new Account();
            account.setUsername(namearr[i]);
            namesList.add(account);
        }

        Scanner scanner = new Scanner(System.in);
        System.out.println("输入要查找的人: ");
        String findName = scanner.next();
        boolean isFind = false;
        for (int i = 0; i < namesList.size(); i++) {
            if (namesList.get(i).getUsername().contains(findName)) {
                System.out.println(namesList.get(i).getUsername());
                isFind=true;
            }
        }
        if(!isFind){
            System.out.println("没有找到这个人");
        }
    }
}
